package com.gitee.wsl.common.ui.base

import androidx.compose.ui.unit.Dp as KDp
import com.gitee.wsl.base.Or
import com.gitee.wsl.base.one
import com.gitee.wsl.base.two

//sealed interface DpOrPercentage: Or<KDp,Int> {
//    class Dp(value: KDp) : Or.One<KDp>(value)
//    class Percentage(@IntRange(0, 100)  value: Int) : Or.Two<Int>(value)
//}

typealias DpOrPercentage = Or<KDp,Int>

val DpOrPercentage.isFill : Boolean
    get() = this.two == -1

val DpOrPercentage.isWarp : Boolean
    get() = this.two == 0

fun DpOrPercentage.onDp(block:(KDp)->Unit):DpOrPercentage = one(block)

fun DpOrPercentage.onPercentage(block:(Int)->Unit):DpOrPercentage = two(block)


fun KDp.toDpOrPercentage():DpOrPercentage = Or.One(this)

fun Int.toDpOrPercentage():DpOrPercentage = Or.Two(this)

fun test1(){
    val a = 1.toDpOrPercentage()
    a.onDp { dp -> }
}